package com.demo.thread.executors;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @author peter
 * @date 2022/3/27 20:02
 */
public class NewCachedThreadPool {


    public static class TargetRunable implements Runnable {
        @Override
        public void run() {
            for (int i = 0; i < 10; i++) {
                System.out.println("线程：" + Thread.currentThread().getId() + ":" + i);
            }
        }
    }

    public static void main(String[] args) {
        System.out.println("线程：" + Thread.currentThread().getId());
        ExecutorService executorService = Executors.newCachedThreadPool();
        executorService.submit(new TargetRunable());
    }
}
